Skip to content

Conversation

@paultiq
Copy link
Owner

@paultiq paultiq commented Sep 17, 2025

This arose from [discussion]:

CI is currently running tests serially in a deterministic order, with some order dependencies due to lack of isolation of both the default connection & test files.

This PR improves the tests by:

  • Randomizing their order: to surface any order dependencies
  • Enabling parallel tests: to reduce total test time
  • Using unique path fixtures or table names to eliminate conflicts across concurrent tests
  • Setting up infrastructure to perform more threading tests, whether in GIL or no-GIL workflows.

Workflow Addition

  • additional_testing.yml: Additional workflow that performs random, multiprocess, and threading tests.

Configuration Changes

  • Add four pytest plugins: pytest-randomly, pytest-xdist, pytest-run-parallel and pytest-timestamper
  • --quiet the uv export - the CI output was excessively long and unreadable
  • Add a 5 min timeout for individual tests, to avoid test hanging in CI / improve detection of which test hung

Test Changes:

  • Modify the duckdb_cursor fixture (conftest.py) to use a tmp_path
  • Modify tests creating / deleting files to use tmp_path fixtures, to ensure test isolation
  • Fix slow test_query_interrupt - was taking 1 minute per run, and was wrong (I believe)
  • Move slow 10M row test_relation to tests/slow

Pytest Plugins

  • pytest-randomly: Applied by default. Randomizes order of all fixtures. Found some test issues already.
  • pytest-timestamper: Adds timestamps to the --verbose output.
  • pytest-xdist: When -n <N | auto> is passed, uses multiple workers to run each test. Speeds up testing, and identifies new test issues.
  • pytest-run-parallel: When --parallel-threads=N --iterations=X is passed, runs multiple threads for each test. Many tests won't work with this, due to concurrent use of default connection.

@paultiq paultiq changed the title Test Concurrency Improving Test Concurrency Sep 17, 2025
@paultiq paultiq closed this Sep 17, 2025
@paultiq paultiq reopened this Sep 17, 2025
@paultiq paultiq closed this Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant